<?php

require_once ('evolution_graph.php');
require_once ('../../lib/jpgraph-3.5.0b1/src/jpgraph.php');
require_once ('../../lib/jpgraph-3.5.0b1/src/jpgraph_line.php');

$id_eleve = $_SESSION['id_eleve'];
$id_atelier = $_SESSION['id_atelier'];

if( !isset($id_atelier) || empty($id_atelier) ) 
  $erreur = "<div class='erreur_div'>Erreur : Champs atelier vide</div>";

if( !isset($id_eleve) || empty($id_eleve) )
  $erreur = "<div class='erreur_div'>Erreur : Champs eleve vide</div>";

if( $erreur != "" )
	 return;
else
{
	$value = get_bilan_seance_par_eleve_atelier($id_eleve, $id_atelier); 
  
	$ydata = $value['value'];

	// Create the graph. These two calls are always required
	$graph = new Graph(600,400);    
	$graph->SetScale("textlin");
	$graph->img->SetMargin(130,90,40,50);
	$graph->yaxis->title->Set("Charge");
	$graph->yaxis->title->setMargin(40);

	$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
	$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);

	$graph->xaxis->title->Set("Date");
	$graph->xaxis->SetTickLabels($value['date']);

	// Create the linear plot
	$lineplot=new LinePlot($ydata);
	$lineplot->SetColor("blue");

	// Add the plot to the graph
	$graph->Add($lineplot);

	// Display the graph
	$graph->Stroke();
}

session_unregister("id_eleve");
session_unregister("id_atelier");
?>
